;(function($) {
  $(document).ready(function() {
    $(".approve-button").click(function () {
      id = $(this).attr('rel');
      $.ajax({
        type: 'POST',
        url: globals.base_url + '/admin/change_status/' + id + '/1',
        success: function () {
          $("#avatar-" + id + "-row .approve-button").hide();
          $("#avatar-" + id + "-row .reject-button").show();
          $("#avatar-" + id + "-row .status-field").html(approved_html);
        }
      });
    });
    $(".reject-button").click(function () {
      id = $(this).attr('rel');
      $.ajax({
        type: 'POST',
        url: globals.base_url + '/admin/change_status/' + $(this).attr('rel') + '/2',
        success: function () {
          $("#avatar-" + id + "-row .approve-button").show();
          $("#avatar-" + id + "-row .reject-button").hide();
          $("#avatar-" + id + "-row .status-field").html(rejected_html);
        }
      });
    });
    
    $(".avatar-single-link").colorbox({
      onComplete:function(){ if(typeof(FB) !== "undefined") {
        FB.Canvas.getPageInfo(
            function(info) {
              $("#colorbox").css("top", (Math.floor((info.clientHeight) / 2) + info.scrollTop)-420);
            }
          );
        }
      }
    });
    
    
  });
  
})(jQuery);
